/**
 * [EmployeeController description]
 */
EmployeeController = function () {
    // 获取用户列表
    this.getEmployeeList = function(param, resetFunc) {
        var serverUrl = App.serverUrl +　"/app/employee/queryEmployee.do";
        var sucFunc = function (result) {
            if (result && result.success) {
                var user1 = sessionStorageClient.getJSON("user");
                // 服务器返回成功
                var userData =result.resultObject;
                var pageData={}; 
                pageData.pageData=[];
                pageData.totalCount=0;
                pageData.nextPage=userData.nextPage;        
                if(userData&&userData.totalCount!=0){
                  for(var i=0;i<userData.pageData.length;i++){
                      if(user1.role==4){                
                          pageData.pageData.push(userData.pageData[i])
                          pageData.totalCount=pageData.totalCount+1;
                     }else{
                        if(userData.pageData[i].roleId!=1){
                          pageData.pageData.push(userData.pageData[i])
                          pageData.totalCount=pageData.totalCount+1;
                        } 
                      }
                  }
                }
                //列表为空
                if(pageData && pageData.totalCount==0){
                    CommonUtil.render($("#userManagePage .page-body #userManageCotainer"), "userManage4NoDataTPL", {mts: pageData.list});
                    disableAddMoreItem("#userManagePage .page-body");
                    return;
                }
                // 格式化后端数据
                CommonUtil.render(
                    $("#userManageCotainer"),
                    "userManagerTPL",
                    {data: pageData.pageData, role:user1.role},
                    param.currentPage > 1
                );
                if (param.currentPage === 1) {
                    // 第一页，清除列表缓存数据
                    employeeManageParams.cache = {};
                    initAddMoreItem("#userManagePage .page-body");
                }
                if (pageData.nextPage > 0) {
                    // TODO 显示更多
                    resetFunc && resetFunc();
                } else {
                    // TODO 没有更多了
                    disableAddMoreItem("#userManagePage .page-body");
                    resetFunc && resetFunc(true);
                }
            } else {
                DialogUtil.dialogWarn(result.msg);
            }
        }


        CommonUtil.sendJsonpRequest({
            url: serverUrl,
            params: param,
            success: sucFunc
        });

    };


};